<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8">
<#assign base=request.contextPath  />
    <title>layui</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <title></title>
    <link rel="stylesheet" href="../frame/layui/css/layui.css">
    <link rel="stylesheet" href="../frame/static/css/style.css">
    <link rel="icon" href="../frame/static/image/code.png">
    <script type="text/javascript" src="../frame/layui/layui.all.js"></script>
    <script type="text/javascript" src="${base}/js/zhang.js"></script>
    <script type="text/javascript" src="../frame/layui/layui.all.js"></script>
    <script src="${base}/js/jquery-1.8.3.min.js"></script>

</head>

<body class="body">
<div class="ziyemianbiju">

        <table class="layui-hide" id="test" lay-filter="test"></table>
        <script type="text/html" id="barDemo">
            <betton class="layui-btn layui-btn-normal layui-btn-xs " lay-event="edit">审核</betton>
        </script>
<script type="text/javascript">
    layui.use(['layer', 'form', 'table'], function () {
        var form = layui.form;
        var table = layui.table;
        var layer = layui.layer;
        var $ = layui.jquery;
        table.render({
            even: true,//开启隔行背景
            size: 'sm',//小尺寸的表格
            elem: '#test',
            toolbar: '#toolbarDemo',
            url: '${base}/wePilejoin/select',
            title: '用户数据表',
            cols: [[
                {field: 'enterprisen', title: '企业名称', align: 'center'}
                , {field: 'name', title: '联系人姓名', align: 'center', templet: '#phoneTpl'}
                , {field: 'phone', title: '联系人手机号', align: 'center'}
                , {field: 'position', title: '位置', align: 'center'}
                , {field: 'loading', title: '桩点数量', align: 'center'}
                , {field: 'power', title: '桩点功率', align: 'center'}
                , {field: 'logistics', title: '适合车辆', align: 'center'}
                , {
                    field: 'pass', title: '是否通过', align: 'center',
                    templet: function (val) {
                        var flag = val.pass;
                        if (flag == 2) {
                            return "不通过"
                        } else {
                            return "通过"
                        }
                    }
                }
                , {field: 'eczxxxxema', title: '操作', align: 'center', toolbar: '#barDemo'}
            ]]
            , id: 'testReload'
            ,height:480
            ,page: {
                layout: ['limit', 'count', 'prev', 'page', 'next', 'skip']
                ,theme: '#9AC747'
                ,limit: 10
            }
        });


        //页面传参
        table.on('tool(test)', function (obj) {
            var layEvent = obj.event;
            if (layEvent == "edit") {
                var data = obj.data;
                //示范一个公告层
                layer.open({
                    type: 2,
                    title: '编辑',
                    shadeClose: false,
                    offset: 't',
                    area: ['100%', '100%'],
                    content: '${base}/wePilejoin/check',
                    success: function (layero, index) {
                        //得到iframe页的窗口对象，执行iframe页的方法：iframeWin.method();
                        var iframeWin = window[layero.find('iframe')[0]['name']];

                        iframeWin.$("#enterprisen").val(data.enterprisen);
                        iframeWin.$("#name").val(data.name);
                        iframeWin.$("#phone").val(data.phone);
                        iframeWin.$("#position").val(data.position);
                        iframeWin.$("#loading").val(data.loading);
                        iframeWin.$("#power").val(data.power);
                        iframeWin.$("#logistics").val(data.logistics);
                        iframeWin.$("#pass").val(data.pass);
                        iframeWin.$("#carbrand").val(data.carbrand);
                        iframeWin.$("#id").val(data.id);
                        //渲染一下form表单
                        iframeWin.layui.form.render('select');
                        iframeWin.layui.form.render();
                    }
                });
            }

        });


    });


</script>
</body>

</html>